from django.db import models
from mongoengine import *
# 链接Mongo数据库
connect('visites', host='127.0.0.1', port=27017)
# Create your models here.


class MenuFood(EmbeddedDocument):
    id = IntField()
    name = StringField()
    price = FloatField()
    remarks = StringField()
    image = StringField()
    status = StringField()     # 菜品状态：   在售 ：Open，售罄 ： Close


class CookBook(Document):
    menu_id = ObjectIdField()
    period_number = StringField()
    status = StringField()  # 菜谱状态：   在售 ：Open，关闭 ： Close
    banner = StringField()
    community_id = ObjectIdField()
    community_name = StringField()
    order_time = StringField()
    delivery_time = StringField()
    hot_push = StringField()
    menu = ListField(EmbeddedDocumentField(MenuFood))

    meta = {'collection': 'cookbook'}   # 指明连接数据库的哪张表


if __name__ == '__main__':
    cookBook = CookBook(status='Open')
    cookBook.save()





